<!DOCTYPE html>
<html>
	<head>
		<title>图片显示和隐藏</title>
	</head>
	<body>
		<button id="overflow">隐藏</button>
		<br>
		<img src="images/1.jpeg" width="300" height="200">
		<script type="text/javascript">
		var butObj = document.getElementsByTagName('button')[0];
		var newImage = document.getElementsByTagName('img')[0];
	 
		butObj.onclick = function(){
			//判断文本内容来操作开关
			if(butObj.innerHTML === '隐藏'){
				newImage.style.display = 'none';
				butObj.innerHTML = '显示';
			}else{
				newImage.style.display = 'block';
				butObj.innerHTML = '隐藏';
			}
		}
	 
		</script>
	 
	</body>
</html>